using System;
using System.Collections;
using System.Globalization;
using Nullables;

namespace Sedna.Core.Security
{
	public interface IPrincipalWrapper
	{

		/// <summary>
		/// looks up a name of a currently installed Identity,
		/// which effectively equals to a username in CoreIMS realm
		/// or domain user name (including either domain or a host prefix in a form 'DOMAINNAME\username'
		/// which is a standard NTLM notation).
		/// In case of the CoreIMS realm that will be a user's login name (IUserInfo.Name)
		/// </summary>
		string IdentityName
		{
			get;
		}

		/// <summary>
		/// tries to look up a 'Full Name' property either in Active Directory (or local repository)
		/// or, in case of the CoreIMS realm from a IUserInfo.Name.
		/// </summary>
		string FullName
		{
			get;
		}

		/// <summary>
		/// currentrly installed culture for a user thread.
		/// this should be used for all formatting.
		/// </summary>
		CultureInfo Culture
		{
			get;
		}

		/// <summary>
		/// checks if a user is in role
		/// </summary>
		/// <param name="roleName">a name of internal(!!) Sedna user role, not the role or permission name defined somewhere in CoreIMS.Base Library or in NTLM</param>
		/// <returns>true if a currently installed principal is in role</returns>
		bool IsInRole(string roleName);

		/// <summary>
		/// returns an Id of a User within the CoreIMS.Base Library (in the underlying database), and NOT the Id or user name that was used to authenticate a User, e.g. a unique username in case of the NTLM.
		/// </summary>
		int ImsUserId
		{
			get;
		}

		/// <summary>
		/// method to determine CultureInfo that is setup as a default 
		/// (e.g. stored in the CoreIMSDB as a user setting) for a current user
		/// The property is read only, use corresponding CoreIMS.Base API 
		/// to update User settings
		/// 
		/// The property first tries to determine the settings, if possible.
		/// If it is not possible the default culture (so far InvariantCulture) is returned.
		/// </summary>
		CultureInfo DefinedCulture
		{
			get;
		}


		/// <summary>
		/// defined CoreIMS User Owner.
		/// Returns NullableInt32.Default (which is == null) if no Owner defined (or no SecurityAPI is installed)
		/// Throws no Excptions, returns null instead
		/// </summary>
		NullableInt32 ImsOwnerId
		{
			get;
		}


		/// <summary>
		/// returns default SiteId for a current User
		/// Returns NullableInt32.Default (which is == null) if no default SiteId is defined for a current User
		/// or no SecurityApi is installed.
		/// Throws no Exceptions, returns null instead.
		/// </summary>
		NullableInt32 DefaultSiteId
		{
			get;
		}


		/// <summary>
		/// returns a List of SiteIds (Int32), set up for a current User.
		/// Returns an empty immutable list if no Site is available or if no SecurityAPI is installed.
		/// Throws no Exception, returns an immutable empty List instead.
		/// </summary>
		IList AvailableSiteIds
		{
			get;
		}

		/// <summary>
		/// checks if a current User is 'site-locked'
		/// Returns false if no SecurityApi is installed
		/// Throws no Exception, returns false instead.
		/// </summary>
		bool IsSiteLock
		{
			get;
		}


		NullableInt32 PageSize
		{
			get;
		}
			
		//the rest of the IUserInfo properties can be added furhter if necessary


	}
}
